{block name="circle_layout"}
	{include file="common:common_layout"}
{/block}
{extend name="common/layout" /}
{block name="style"}{/block}
{block name="content"}

<div class="base-layout">
    <div class="mainbox">
        {include file="circle:manage:top" /}
       
        <table class="base-table-style">
            <thead>
            <tr>
                <th class="w30"></th>
                <th class="tl">名称</th>
                <th class="w120">排序</th>
                <th class="w120">状态</th>
                <th class="w120">操作</th>
            </tr>
            <tr>
                <?php if(!empty($thclass_list)){?>
                <td class="tc"><input id="all" class="checkall" type="checkbox" /></td>
                <td colspan="3"><label for="all" class="handle-btn"><i class="ac0"></i>全选</label>
                    <a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/class_del')}?c_id=<?php echo $c_id;?>" name="thc_id" confirm="确认删除"><i class="ac5"></i>删除</a></td>
                <?php }?>
                <td colspan="20" class="tr"><?php if(count($thclass_list) <10){?><a href="javascript:void(0);" nctype="add_thclass" class="add-group-class-btn mr10">添加分类</a><?php }else{echo '只能创建10个分类';}?></td>
            </tr>
            </thead>
            <tbody>
            <?php if(!empty($thclass_list)){?>
            <?php foreach (($thclass_list) as $val){?>
            <tr>
                <td><input type="checkbox" class="checkitem" value="<?php echo $val['thclass_id'];?>" /></td>
                <td class="tl"><?php echo $val['thclass_name'];?></td>
                <td><?php echo $val['thclass_sort'];?></td>
                <td><?php if($val['thclass_status'] == 1){echo '开启';}else{echo '关闭';}?></td>
                <td class="handle"><a href="javascript:void(0);" onclick="edit_thclass(<?php echo $val['thclass_id'];?>)">编辑</a>&nbsp;|&nbsp;<a href="javascript:void(0);" onclick="del_thclass(<?php echo $val['thclass_id'];?>)">删除</a></td>
            </tr>
            <?php }?>
            <?php }else{?>
            <tr>
                <td colspan="20" class="noborder"><p class="no-record">没有符合条件的记录</p></td>
            </tr>
            <?php }?>
            </tbody>
            <?php if(!empty($thclass_list)){?>
            <tfoot>
            <tr>
                <th class="tc"><input id="all" class="checkall" type="checkbox" /></th>
                <th colspan="20"><label for="all" class="handle-btn"><i class="ac0"></i>全选</label>
                    <a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/class_del')}?c_id=<?php echo $c_id;?>" name="thc_id" confirm="确认删除"><i class="ac5"></i>删除</a> </th>
            </tr>
            </tfoot>
            <?php }?>
        </table>
    </div>
    <div class="sidebar">
        {include file="circle:manage:sidebar" /}

    </div>
</div>
<script src="__CIRCLE_RESOURCE__/js/circle_manage.js"></script>
<script type="text/javascript" src="__SITE_RESOURCE__/js/jquery.validation.min.js"></script>
<script>
    $(function(){
        // 添加分类
        $('a[nctype="add_thclass"]').click(function(){
            _uri = "<?php echo url('circle/manage/class_add');?>?inajax=1&c_id=<?php echo $c_id;?>";
            CUR_DIALOG = ajax_form('add_thclass', '添加分类', _uri, 520);
        });
    });
    function edit_thclass(id){
        _uri = "<?php echo url('circle/manage/class_edit');?>?inajax=1&c_id=<?php echo $c_id;?>&thc_id="+id;
        CUR_DIALOG = ajax_form('edit_thclass', '编辑分类', _uri, 520);
    }
    function del_thclass(id){
        showDialog('您确定要删除吗?', 'confirm', '', function(){
            _uri = "<?php echo url('circle/manage/class_del');?>?inajax=1&c_id=<?php echo $c_id;?>&thc_id="+id;
            ajaxget(_uri);
        });
    }
</script>
{/block}